package net.lab1024.sa.admin.module.business.file.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import net.lab1024.sa.admin.module.business.file.domain.entity.ApptemordEntity;
import net.lab1024.sa.admin.module.business.file.domain.form.add.ApptemordAddForm;
import net.lab1024.sa.admin.module.business.file.domain.form.query.ApptemordQueryForm;
import net.lab1024.sa.admin.module.business.file.domain.form.update.ApptemordUpdateForm;
import net.lab1024.sa.admin.module.business.file.domain.vo.ApptemordVO;
import net.lab1024.sa.admin.module.business.file.service.ApptemordService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 审批模板主表 Controller
 *
 * @Author AKITA
 * @Date 2025-04-23 09:53:21
 * @Copyright AKITA
 */

@RestController
@Tag(name = "审批模板主表")
public class ApptemordController {

    @Resource
    private ApptemordService apptemordService;

    @PostMapping("/apptemord/queryPage")
    public ResponseDTO<PageResult<ApptemordVO>> queryPage(@RequestBody @Valid ApptemordQueryForm queryForm) {
        return ResponseDTO.ok(apptemordService.queryPage(queryForm));
    }

    @PostMapping("/apptemord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid ApptemordAddForm addForm) {
        return apptemordService.add(addForm);
    }

    @PostMapping("/apptemord/update")
    public ResponseDTO<String> update(@RequestBody @Valid ApptemordUpdateForm updateForm) {
        return apptemordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return apptemordService.batchDelete(idList);
    }

    @GetMapping("/apptemord/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return apptemordService.delete(docEntry);
    }

    @GetMapping("/apptemord/info/{docEntry}")
    public ResponseDTO<ApptemordEntity> info(@PathVariable Long docEntry) {
        return apptemordService.info(docEntry);
    }

}
